package com.tensquare.recruit.controller;

import com.tensquare.recruit.pojo.Enterprise;
import com.tensquare.recruit.service.EnterpriseService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * & ProjectName：  tensquare-parent
 * & PackageName:   com.tensquare.recruit.controller
 * & Creation_Date： 2020/3/31 00:03
 * & Author：しの
 * ----------------------------------
 * & Description:
 */
@RestController
@RequestMapping("/enterprise")
public class EnterpriseController {
    @Autowired
    private EnterpriseService enterpriseService;

    //1 条件查询热门企业
    @GetMapping("/search/hotlist")
    public Result searchHotlist() {
        List<Enterprise> enterpriseList = null;
        try {
            enterpriseList = enterpriseService.searchHotlist();
            return new Result(true, StatusCode.OK, "查询热门企业成功", enterpriseList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new Result(false, StatusCode.ERROR, "查询热门企业失败");
    }
}
